<template>
	<view class="content">
		<view class="title" style="font-size: 1.5rem; font-weight: bold;">
			子组件B
		</view>
		<view class="b-box">
			CompA组件传进来的值：
			<text class="intent-text-box">{{result}}</text>
		</view>
		<view class="b-box" style="margin: 10rpx; display: flex;">
			<text>回传值：</text>
			<input type="text" v-model="callbackValue" style="color:yellow;" />
			<button @click="sendOutside()" size="mini">回传</button>
		</view>
	</view>
</template>

<script>
	export default {
		name:"comB",
		created(){
			uni.$on('getIntent', (msg) => {
				console.error("--CompB--getIntent-->" + msg);
				this.result = msg;
			})
		},
		data() {
			return {
				result: '',
				callbackValue: ''
			};
		},
		methods:{
			sendOutside(){
				console.warn("--CompB--sendOutsid--->" + this.callbackValue);
				this.$emit('callBackFun', this.callbackValue);
			}
		}
	}
</script>

<style>

</style>